package com.Cychat.doctor.service.impl;

import com.Cychat.commons.entity.pojo.Appointment;
import com.Cychat.commons.entity.vo.AppointmentDetailVo;
import com.Cychat.doctor.mapper.AppointmentMapper;
import com.Cychat.doctor.service.AppointmentService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;

import java.util.List;

/**
 * 预约记录Service实现
 */
@Service
public class AppointmentServiceImpl extends ServiceImpl<AppointmentMapper, Appointment> implements AppointmentService {

    /**
     * 查询当前医生的所有预约记录
     */
    @Override
    public List<AppointmentDetailVo> getDoctorAppointmentList(Integer doctorId) {
        Assert.notNull(doctorId, "医生ID不能为空");
        // 直接调用Mapper连表查询
        return baseMapper.selectDoctorAppointmentList(doctorId);
    }

    /**
     * 查询当前医生的预约详情
     */
    @Override
    public AppointmentDetailVo getDoctorAppointmentDetail(Integer appointmentId, Integer doctorId) {
        Assert.notNull(appointmentId, "预约ID不能为空");
        Assert.notNull(doctorId, "医生ID不能为空");
        // 调用Mapper连表查询（含权限校验）
        return baseMapper.selectDoctorAppointmentDetail(appointmentId, doctorId);
    }
}